package application

import (
	"ruoyi/domain/entity/common"
	"ruoyi/domain/entity/response"
	"ruoyi/domain/entity/system"
	"ruoyi/domain/repository"
)

type RoleApp struct {
	role repository.SysRoleRepository
}

var _ RoleAppInterface = &RoleApp{}

type RoleAppInterface interface {
	SelectRolePermissionByUserId(userId int) []system.SysRole

	BuildRolePermissionByUserId(userId int) []string

	GetRolePermission(user system.SysUser) []string

	GetRolePermissionById(userId int) []string

	GetMenuPermission(user system.SysUser) []string

	SelectRolesByUserName(userName string) string

	SelectRoleList(params common.SearchTableDataParam, isPage bool) common.TableDataInfo

	AddRolesByUser(user system.SysUserParam)

	InsertRolesByUser(userId int, roleIds []int) response.Response

	DeleteRolesByUser(userId []int)

	DeleteRolesById(roleId string, userId int)

	FindRoleInfoById(roleId string) system.SysRole

	CheckRoleDataScope(roleId string) bool

	SaveRole(roles system.SysRolesParam) response.Response

	UploadRole(rolesParam system.SysRolesParam, userId int) response.Response

	PutDataScope(rolesParam system.SysRolesParam, userId int) response.Response

	ChangeRoleStatus(rolesParam system.SysRole, userId int) response.Response

	GetRoleOptionSelect() response.Response

	GetAllocatedList(params common.SearchTableDataParam) common.TableDataInfo

	GetUnAllocatedList(params common.SearchTableDataParam) common.TableDataInfo

	CancelRole(userId int, roleId int) response.Response

	CancelAllRole(roleId string, userIds string) response.Response

	SelectRoleAll(roleId string, userIdStr string, userId int) response.Response

	GetDeptTreeRole(roleId string) []int
}

func (r *RoleApp) GetRolePermission(user system.SysUser) []string {
	return r.role.GetRolePermission(user)
}

func (r *RoleApp) GetMenuPermission(user system.SysUser) []string {
	return r.role.GetMenuPermission(user)
}

func (r *RoleApp) SelectRolePermissionByUserId(userId int) []system.SysRole {
	return r.role.SelectRolePermissionByUserId(userId)
}

func (r *RoleApp) BuildRolePermissionByUserId(userId int) []string {
	return r.role.BuildRolePermissionByUserId(userId)
}

func (r *RoleApp) GetRolePermissionById(userId int) []string {
	return r.role.GetRolePermissionById(userId)
}

func (r *RoleApp) SelectRolesByUserName(userName string) string {
	return r.role.SelectRolesByUserName(userName)
}

func (r *RoleApp) SelectRoleList(params common.SearchTableDataParam, isPage bool) common.TableDataInfo {
	return r.role.SelectRoleList(params, isPage)
}

func (r *RoleApp) AddRolesByUser(user system.SysUserParam) {
	r.role.AddRolesByUser(user)
}

func (r *RoleApp) InsertRolesByUser(userId int, roleIds []int) response.Response {
	return r.role.InsertRolesByUser(userId, roleIds)
}

func (r *RoleApp) DeleteRolesByUser(userId []int) {
	r.role.DeleteRolesByUser(userId)
}

func (r *RoleApp) DeleteRolesById(roleId string, userId int) {
	r.role.DeleteRolesById(roleId, userId)
}

func (r *RoleApp) FindRoleInfoById(roleId string) system.SysRole {
	return r.role.FindRoleInfoById(roleId)
}

func (r *RoleApp) CheckRoleDataScope(roleId string) bool {
	return r.role.CheckRoleDataScope(roleId)
}

func (r *RoleApp) SaveRole(roles system.SysRolesParam) response.Response {
	return r.role.SaveRole(roles)
}

func (r *RoleApp) UploadRole(rolesParam system.SysRolesParam, userId int) response.Response {
	return r.role.UploadRole(rolesParam, userId)
}

func (r *RoleApp) PutDataScope(rolesParam system.SysRolesParam, userId int) response.Response {
	return r.role.PutDataScope(rolesParam, userId)
}

func (r *RoleApp) ChangeRoleStatus(rolesParam system.SysRole, userId int) response.Response {
	return r.role.ChangeRoleStatus(rolesParam, userId)
}

func (r *RoleApp) GetRoleOptionSelect() response.Response {
	return r.role.GetRoleOptionSelect()
}

func (r *RoleApp) GetAllocatedList(params common.SearchTableDataParam) common.TableDataInfo {
	return r.role.GetAllocatedList(params)
}

func (r *RoleApp) GetUnAllocatedList(params common.SearchTableDataParam) common.TableDataInfo {
	return r.role.GetUnAllocatedList(params)
}

func (r *RoleApp) CancelRole(userId int, roleId int) response.Response {
	return r.role.CancelRole(userId, roleId)
}

func (r *RoleApp) CancelAllRole(roleId string, userIds string) response.Response {
	return r.role.CancelAllRole(roleId, userIds)
}

func (r *RoleApp) SelectRoleAll(roleId string, userIdStr string, userId int) response.Response {
	return r.role.SelectRoleAll(roleId, userIdStr, userId)
}

func (r *RoleApp) GetDeptTreeRole(roleId string) []int {
	return r.role.GetDeptTreeRole(roleId)
}
